/**
 * 
 */
package br.com.cotec.controller.painelcontrole;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.ejb.EJB;
import javax.faces.model.SelectItem;

import br.com.cotec.manager.FuncaoManager;
import br.com.cotec.model.Funcao;

/**
 * @author Magalhaes
 *
 */
public class FuncaoMB {
	
	@EJB(name = "funcaoManager")
	private FuncaoManager funcaoManager;
	
	public List<SelectItem> funcaoOpts;
	
	public List<SelectItem> getFuncaoOpts() {
		return geraListagemFuncao();
	}
	
	public List<SelectItem> geraListagemFuncao() {
		List<Funcao> funcaoList = funcaoManager.getAll(new Funcao());
		List<SelectItem> funcaoItem = new ArrayList<SelectItem>();
		for (Iterator<Funcao> iterator = funcaoList.iterator(); iterator.hasNext();) {
			funcaoItem.add(new SelectItem(iterator.next().getNome()));
		}

		return funcaoItem;
	}
}